from common.base import Base

class OrderPage(Base):

    user_loc = ("xpath","/html/body/div[6]/div/p/a[2]") # 定位用户中心
    myorder_loc = ("xpath","/html/body/div[6]/div[1]/div/div/div/div/a[3]") # 定位我的订单
    order1_loc = ("css selector","body>div.block.clearfix.userpage>div.AreaR>div>div>div>table>tbody>tr:nth-child(1)>td:nth-child(1)>a") # 定位用户中心订单号
    order_loc = ("css selector","body > div:nth-child(7) > div > h6 > font") # 订单号

    def click_uesr(self):
        # 点击用户中心
        self.click(self.user_loc)

    def click_myorder(self):
        # 点击我的订单
        self.click(self.myorder_loc)

    def click_order1(self):
        # 点击订单号
        self.click(self.order1_loc)

    def order(self):
        # 订单号
        order_num = self.find_element(self.order_loc)
        res = order_num.text
        print(f"成功下单后的订单号{res}")
        return res

    def order1(self):
        # 用户中心订单号
        order_num1 = self.find_element(self.order1_loc)
        res1 = order_num1.text
        print(f"成功下单后的订单号{res1}")
        return res1


